import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)

/**
 * Write a description of class Turbe here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class Turbe extends Actor
{
    private GreenfootImage ima;
    private int desvanecer;
    
    public Turbe()
    {
        ima=getImage();
        desvanecer=Greenfoot.getRandomNumber(4)+1;
        if(desvanecer==4)
        {
            desvanecer=2;
        }
    }    
    
    public void act()
    {
        desva();
    }
    
    private void desva()
    {
        if(getImage().getWidth()<10)
        {
            getWorld().removeObject(this);
        }
        else
            {
                GreenfootImage imag= new GreenfootImage(ima);
                imag.scale(getImage().getWidth() - desvanecer, getImage().getHeight() - desvanecer);
                imag.setTransparency(getImage().getTransparency() - (desvanecer*5));
                setImage(imag);
            }
            
    }
    
}
